@extends('admin.public.admin')
@section('main')
<script src="/style/admin/js/libs/jquery-1.8.3.min.js"></script>/
<script src="/style/admin/js/sys/sysads.js"></script>
<meta name="csrf-token" content="{{ csrf_token() }}">
<div class="mws-panel grid_8">
  <div class="mws-panel-header">
    <span>
      <i class="icon-table"></i>广告管理</span>
  </div>
  <div class="mws-panel-body no-padding">
    <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper" role="grid">
      <div id="DataTables_Table_0_length" class="dataTables_length">
        <label>

            <form method="get" action="/admin/sys/typeads"><!--用来分页的form表单-->

          <select size="1" name="count" aria-controls="DataTables_Table_0">
            <option value="10" @if(!empty($request['count']) && $request['count']== 10) selected @endif>10</option>
            <option value="20" @if(!empty($request['count']) && $request['count'] == 20) selected @endif>20</option>
            <option value="30" @if(!empty($request['count']) && $request['count'] == 30) selected @endif>30</option>
            <option value="40" @if(!empty($request['count']) && $request['count'] == 40) selected @endif)>40</option></select>entries</label>
      </div>
      <div class="dataTables_filter" id="DataTables_Table_0_filter">
        <a href="/admin/sys/typeads/create"><button type="button" class="btn btn-success">添加广告</button></a>
        <label>
          <input type="text" name="search" value="{{$request['search'] or ''}}" aria-controls="DataTables_Table_0"></label>
            <button type="submit" class="btn btn-success">搜索</button>
          </div>

        </form>

        <label>
      <table class="mws-datatable mws-table dataTable" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
        <thead>
          <tr role="row">
          <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 117px;">排序</th>
            <th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending" style="width: 149px;">所属分类</th>
            <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending" style="width: 224px;">图片</th>
            <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending" style="width: 120px;">标题</th>
            <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 167px;">连接</th>
            <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 167px;">是否大图</th>
             <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending" style="width: 167px;">操作</th>
        </thead>
        <tbody role="alert" aria-live="polite" aria-relevant="all">
    @if($data)
          @foreach($data as $v)
          <tr class="odd">
            <td class=" sorting_1">{{$v['sort']}}</td>
            <td class=" ">{{\DB::table("types")->where('id',$v['tid'])->first()['typename']}}</td>
            <td class=" "><img width="100" height="50" src="{{$v['img']}}" alt="" /></td>
            <td class=" ">{{$v['title']}}</td>
            <td class=" ">{{$v['href']}}</td>
            <td class=" ">
            @if($v['type']==0)
            <a href="/admin/sys/typeads/{{$v['id']}}"><button type="button" class="btn tn-danger">否</button></a>
            @else
            <a href="/admin/sys/typeads/{{$v['id']}}"><button type="button" class="btn btn-success">是</button></a>
            @endif
            </td>
            <td class=" ">
              <a href="/admin/sys/typeads/{{$v['id']}}/edit"><button type="button" class="btn btn-success">修改</button></a>
             <button type="button" onclick="mm({{$v['id']}})" class="btn btn-danger">删除</button>
            </td></tr>
            @endforeach
    @else
    @endif
          <tr class="even"></tbody>
      </table>
      <!-- 分页 -->
              <div id="page_page">
                   {!! $data->appends($request)->render()!!}
              </div>
    </div>
  </div>
</div>

@endsection